/*
 * @param id 分页对象显示的id
 * @param pageInfo 分页对象
 * @param callback 点击下一页后回调的函数
 */
function getDivPage(id,pageInfo,showPageDataList)
{
	var pageInfo=jQuery.parseJSON(pageInfo);
//	var pageInfo = JSON.parse(pageInfo);
	if(null != pageInfo)
	{
		$("#"+id+"_box").text("");
		
		var htmlContent = "<div id='"+id+"_page_box' class='commonPage'>" +
		"<span id='"+id+"_index' class='pageRoll first'></span>" +
		"<span id='"+id+"_previous' class='pageRoll previous'></span>" +
		"<span id='"+id+"_currentPage' class='pagestatus current'>1</span>" +
		"<span id='"+id+"_next' class='pageRoll next'></span>" +
		"<span id='"+id+"_last' class='pageRoll last'></span>" +
		"<span id='"+id+"_pageStatus' class='pagestatus'>跳转到<input id='"+id+"_pageChange' class='redirect' type='text' value=''/>" +
		"<span id='"+id+"_pageTotalSize'>共10页，200条记录</span>" +
		"</span></div>";
		
		$("#"+id+"_box").append(htmlContent);
		pageInfo.result = null;
		//如果前一页有值
		if(pageInfo.hasPre)
		{
			$("#"+id+"_index").unbind().bind('click',function(){
				pageInfo.pageNo = 1;
				showPageDataList(pageInfo.pageNo);
			})
			$("#"+id+"_previous").unbind().bind('click',function(){
				pageInfo.pageNo --;
				showPageDataList(pageInfo.pageNo);
			})
		}
		else
		{
			$("#"+id+"_index").unbind();
			$("#"+id+"_previous").unbind();
			$("#"+id+"_index").addClass("disabled");
			$("#"+id+"_previous").addClass("disabled");
		}
		
		//如果后一页有值
		if(pageInfo.hasNext)
		{
			$("#"+id+"_next").unbind().bind('click',function(){
				pageInfo.pageNo ++;
				showPageDataList(pageInfo.pageNo);
			})
			$("#"+id+"_last").unbind().bind('click',function(){
				pageInfo.pageNo = pageInfo.totalPage;
				showPageDataList(pageInfo.pageNo);
			})
		}
		else
		{
			$("#"+id+"_next").unbind();
			$("#"+id+"_last").unbind();
			$("#"+id+"_next").addClass("disabled");
			$("#"+id+"_last").addClass("disabled");
		}
	
		$("#"+id+"_pageChange").keydown(function(event){
			if(event.keyCode == 13)
			{
				var inputValue = $("#"+id+"_pageChange").val();
				var regix =/^[1-9]+[0-9]*$/;
				if("" !== inputValue && !regix.test(inputValue))
				{
					alert("请输入合法的页码");
					return;
				}
				else if(inputValue > pageInfo.totalPage)
				{
					$("#"+id+"_pageChange").val(pageInfo.totalPage);
					inputValue = pageInfo.totalPage;
				}
				$("#"+id+"_pageChange").blur();
				pageInfo.pageNo = inputValue;
				showPageDataList(pageInfo.pageNo);
				
			}
		});
		
		//当前第几页
		$("#"+id+"_currentPage").text(pageInfo.pageNo);
		
		//共几页,几条记录
		$("#"+id+"_pageTotalSize").text("共"+pageInfo.totalPage+"页，"+pageInfo.totalCount+"条记录");
	}
}
